package fr.upmc.aladyn.transactionables.saveobject;

import java.util.Stack;

/**
 * <p>Class used to store SaveRestoreObjects into a Stack</p>
 * @author Alexis Deluze
 *
 */
public class StackOfSaveRestoreObjects {

	private Stack<SaveRestoreObject> sros;
	
	/**
	 * Constructor
	 */
	public StackOfSaveRestoreObjects() {
		this.sros = new Stack<SaveRestoreObject>();
	}

	/**
	 * <p>Get the Stack of SaveRestoreObjects</p>
	 * @return the Stack of SaveRestoreObjects
	 */
	public Stack<SaveRestoreObject> getStack(){
		return sros;
	}
	
	/**
	 * <p>Add a new SaveRestoreObject to the Stack</p>
	 * @param sro the SaveRestoreObject to add
	 */
	public void add(SaveRestoreObject sro){
		sros.add(sro);
	}
	
	/**
	 * <p>Remove and returs the last element of the Stack</p>
	 * @return the last element of the Stack
	 */
	public SaveRestoreObject removeLast(){
		return sros.pop();
	}
}
